#include <stdio.h>

int main ()
{
	double x = 0;
	double y = 0;
	int k = 0;
	double r = 0; 
	
	scanf("%lf %lf",&y,&x);
	while(k*x <= y)
	{
		r = y - k*x;
		k++;
		
	}
	
	printf("%g",r);
	
	return 0; 
}
